<template>
	<view>
		<view class="main">
		<textarea class="title" auto-height placeholder="请输入标题" maxlength="150" v-model="title"></textarea>
		<textarea class="content" auto-height placeholder="请输入内容" maxlength="150" v-model="content"></textarea>
		</view>
		<button @click="submit" :class=" title !== '' && content !== '' ? 'active' : ''" :disabled="title !== '' && content !== '' ? false : true">提交</button>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				title: '',
				content: ''
			};
		},
		methods: {
			submit(){
				this.$request({
					url: '/prod-api/api/common/feedback',
					method: 'POST',
					data:{
						title: this.title,
						content: this.content
					}
				}).then(res => {
					if(res.code === 200){
						uni.showToast({
							title:'提交成功'
						})
						setTimeout(() => {
							uni.switchTab({
								url:'/pages/user/user'
							})
						}, 1000)
					}else{
						uni.showToast({
							icon:'error',
							title:res.msg
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
page{
	background-color: #fff;
	view{
		width: 100%;
		.main{
			padding: 20rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			.title{
				min-height: 180rpx;
				border: 2rpx solid #e4e7ed;
				padding: 20rpx;
				border-radius: 20rpx;
			}
			.content{
				min-height: 400rpx;
				border: 2rpx solid #e4e7ed;
				padding: 20rpx;
				border-radius: 20rpx;
				margin-top: 80rpx;
			}
		}
		button{
			background-color: #c8c9cc;
			width: 200rpx;
			height: 80rpx;
			color: white;
			display: flex;
			justify-content: center;
			align-items: center;
		}
		.active{
			background-color: #2979ff;
		}
	}
}
</style>
